/**
 * 
 */
package qy.jalgotrade.optimizer.base;

import java.util.function.Predicate;

/**
 * @author c-geo
 *
 */
public class GreaterResultSinc extends AbstractResultSinc {

	/**
	 * 
	 */
	public GreaterResultSinc() {

		this(null, false);
	}

	/**
	 * 
	 * @param resultFilter
	 */
	public GreaterResultSinc(Predicate<Results> resultFilter) {

		this(resultFilter, false);
	}

	/**
	 * 
	 * @param resultFilter
	 * @param recordAllResults
	 */
	public GreaterResultSinc(Predicate<Results> resultFilter, boolean recordAllResults) {

		super(resultFilter, recordAllResults);
	}

	/*
	 * (non-Javadoc)
	 * @see qy.jalgotrade.optimizer.base.AbstractResultSinc#doUpdateBestResultAndParameters(qy.jalgotrade.optimizer.base.Results, qy.jalgotrade.optimizer.base.OptimizingGoal)
	 */
	@Override
	protected void doUpdateBestResultAndParameters(Results newResult, OptimizingGoal goal) {

		Results currBestResult = getBest();
		if (newResult.getBy(goal.getGoalKpi()) > currBestResult.getBy(goal.getGoalKpi())) {
			updateBest(newResult);
		}
	}
}
